package com.kai.service.user.controller;

import com.kai.service.data.Result;
import com.kai.service.data.response.user.RecommendUserInfoResponse;
import com.kai.service.user.service.IUserFocusService;
import com.kai.service.util.ResultResponseUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
@Tag(name = "关注粉丝")
public class UserFocusController {

    @Autowired
    private IUserFocusService userFocusService;

    /**
     * 关注取关
     *
     * @param fansId
     * @param bloggerId
     * @return
     */
    @PostMapping("/focus")
    @Operation(summary = "关注取关")
    public Result<Boolean> focus(@RequestParam("fansId") Long fansId, @RequestParam("bloggerId") Long bloggerId){
        return ResultResponseUtil.success(userFocusService.focus(fansId, bloggerId));
    }

    /**
     * 获取推荐用户
     *
     * @param userId
     * @return
     */
    @GetMapping("/recommend")
    @Operation(summary = "获取推荐用户")
    public Result<List<RecommendUserInfoResponse>> recommendUserInfo(@RequestParam("userId") Long userId){
        return ResultResponseUtil.success(userFocusService.recommendUserInfo(userId));
    }
}
